package cn.tedu._03vehicle.base.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.HttpRequestHandler;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.handler.SimpleUrlHandlerMapping;

import java.util.Collections;

@Configuration
public class FaviconConfig
{


        // 方案 2.1：禁用 favicon 处理
        @Bean
        public SimpleUrlHandlerMapping customFaviconHandlerMapping() {
            SimpleUrlHandlerMapping mapping = new SimpleUrlHandlerMapping();
            mapping.setOrder(Integer.MIN_VALUE);
            mapping.setUrlMap(Collections.singletonMap(
                    "/favicon.ico",
                    (HttpRequestHandler) (request, response) -> response.setStatus(404)
            ));
            return mapping;
        }


}
